package com.zjht.gmcc.servlet.task;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;


import com.zjht.gmcc.bean.util.Menu;
import com.zjht.gmcc.bean.util.MySession;

public class TaskView extends HttpServlet {

	private static final long serialVersionUID = 10000010L;

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		PrintWriter out = response.getWriter();
		if (!MySession.ValidSessionServlet(request, out, Menu.TASK_CURRENTTASK))
			return;

		response.setContentType("text/xml;charset=UTF-8");
		response.setHeader("Cache-Control", "no-cache");
		request.setCharacterEncoding("GBK");

		String strTaskID = request.getParameter("id");

		if (strTaskID == null || strTaskID.length() == 0)
			return;
		StringBuilder s = new StringBuilder("<state>");

		HttpSession session = request.getSession();

		boolean isOK = true;

		s.append("<value>");
		if (isOK) {
			s.append("1</value>");
			s.append("<value>" + session.getAttribute(MySession.TASK_MSGCOUNT) + "</value>");
			s.append("<value>" + session.getAttribute(MySession.TASK_FIRSTTASKLIST) + "</value>");
		} else
			s.append("0</value>");

		s.append("</state>");
		out.write(s.toString());
	}
}
